<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.5: http://docutils.sourceforge.net/" />
<meta name="version" content="S5 1.1" />
<meta name="true generator" content="crst2s5.py pre-alpha"/>
<meta name="true version" content="S5 1.2a modified"/>
<title>crst2s5 How To</title>
<meta name="authors" content="André Roberge" />
<meta name="date" content="circa september 2009" />
<style type="text/css">

/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 5196 2007-06-03 20:25:28Z wiemann $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.

See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/

/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
  border: 0 }

table.borderless td, table.borderless th {
  /* Override padding for "table.docutils td" with "! important".
     The right padding separates the table cells. */
  padding: 0 0.5em 0 0 ! important }

.first {
  /* Override more specific margin styles with "! important". */
  margin-top: 0 ! important }

.last, .with-subtitle {
  margin-bottom: 0 ! important }

.hidden {
  display: none }

a.toc-backref {
  text-decoration: none ;
  color: black }

blockquote.epigraph {
  margin: 2em 5em ; }

dl.docutils dd {
  margin-bottom: 0.5em }

/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
  font-weight: bold }
*/

div.abstract {
  margin: 2em 5em }

div.abstract p.topic-title {
  font-weight: bold ;
  text-align: center }

div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
  margin: 2em ;
  border: medium outset ;
  padding: 1em }

div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
  font-weight: bold ;
  font-family: sans-serif }

div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title {
  color: red ;
  font-weight: bold ;
  font-family: sans-serif }

/* Uncomment (and remove this text!) to get reduced vertical space in
   compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
  margin-bottom: 0.5em }

div.compound .compound-last, div.compound .compound-middle {
  margin-top: 0.5em }
*/

div.dedication {
  margin: 2em 5em ;
  text-align: center ;
  font-style: italic }

div.dedication p.topic-title {
  font-weight: bold ;
  font-style: normal }

div.figure {
  margin-left: 2em ;
  margin-right: 2em }

div.footer, div.header {
  clear: both;
  font-size: smaller }

div.line-block {
  display: block ;
  margin-top: 1em ;
  margin-bottom: 1em }

div.line-block div.line-block {
  margin-top: 0 ;
  margin-bottom: 0 ;
  margin-left: 1.5em }

div.sidebar {
  margin: 0 0 0.5em 1em ;
  border: medium outset ;
  padding: 1em ;
  background-color: #ffffee ;
  width: 40% ;
  float: right ;
  clear: right }

div.sidebar p.rubric {
  font-family: sans-serif ;
  font-size: medium }

div.system-messages {
  margin: 5em }

div.system-messages h1 {
  color: red }

div.system-message {
  border: medium outset ;
  padding: 1em }

div.system-message p.system-message-title {
  color: red ;
  font-weight: bold }

div.topic {
  margin: 2em }

h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
  margin-top: 0.4em }

h1.title {
  text-align: center }

h2.subtitle {
  text-align: center }

hr.docutils {
  width: 75% }

img.align-left {
  clear: left }

img.align-right {
  clear: right }

ol.simple, ul.simple {
  margin-bottom: 1em }

ol.arabic {
  list-style: decimal }

ol.loweralpha {
  list-style: lower-alpha }

ol.upperalpha {
  list-style: upper-alpha }

ol.lowerroman {
  list-style: lower-roman }

ol.upperroman {
  list-style: upper-roman }

p.attribution {
  text-align: right ;
  margin-left: 50% }

p.caption {
  font-style: italic }

p.credits {
  font-style: italic ;
  font-size: smaller }

p.label {
  white-space: nowrap }

p.rubric {
  font-weight: bold ;
  font-size: larger ;
  color: maroon ;
  text-align: center }

p.sidebar-title {
  font-family: sans-serif ;
  font-weight: bold ;
  font-size: larger }

p.sidebar-subtitle {
  font-family: sans-serif ;
  font-weight: bold }

p.topic-title {
  font-weight: bold }

pre.address {
  margin-bottom: 0 ;
  margin-top: 0 ;
  font-family: serif ;
  font-size: 100% }

pre.literal-block, pre.doctest-block {
  margin-left: 2em ;
  margin-right: 2em }

span.classifier {
  font-family: sans-serif ;
  font-style: oblique }

span.classifier-delimiter {
  font-family: sans-serif ;
  font-weight: bold }

span.interpreted {
  font-family: sans-serif }

span.option {
  white-space: nowrap }

span.pre {
  white-space: pre }

span.problematic {
  color: red }

span.section-subtitle {
  /* font-size relative to parent (h1..h6 element) */
  font-size: 80% }

table.citation {
  border-left: solid 1px gray;
  margin-left: 1px }

table.docinfo {
  margin: 2em 4em }

table.docutils {
  margin-top: 0.5em ;
  margin-bottom: 0.5em }

table.footnote {
  border-left: solid 1px black;
  margin-left: 1px }

table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
  padding-left: 0.5em ;
  padding-right: 0.5em ;
  vertical-align: top }

table.docutils th.field-name, table.docinfo th.docinfo-name {
  font-weight: bold ;
  text-align: left ;
  white-space: nowrap ;
  padding-left: 0 }

h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
  font-size: 100% }

ul.auto-toc {
  list-style-type: none }

</style>
<!-- configuration parameters -->
<meta name="defaultView" content="slideshow" />
<meta name="controlVis" content="hidden" />
<!-- style sheet links -->
<script src="ui/pycon_light/slides.js" type="text/javascript"></script>
<link rel="stylesheet" href="ui/pycon_light/slides.css"
      type="text/css" media="projection" id="slideProj" />
<link rel="stylesheet" href="ui/pycon_light/outline.css"
      type="text/css" media="screen" id="outlineStyle" />
<link rel="stylesheet" href="ui/pycon_light/print.css"
      type="text/css" media="print" id="slidePrint" />
<link rel="stylesheet" href="ui/pycon_light/opera.css"
      type="text/css" media="projection" id="operaFix" />

<style type="text/css">
#currentSlide {display: none;}
</style>
</head>
<body>
<div class="layout">
<div id="controls"></div>
<div id="currentSlide"></div>
<div id="header">

</div>
<div id="footer">
<h1>crst2s5 How To</h1>
<h2>Use at: Pycon 2010 Atlanta - February 2010.</h2>
</div>
</div>
<div class="presentation">
<div class="slide" id="slide0">
<h1 class="title">crst2s5 How To</h1>
<table class="docinfo" frame="void" rules="none">
<col class="docinfo-name" />
<col class="docinfo-content" />
<tbody valign="top">
<tr><th class="docinfo-name">Authors:</th>
<td>André Roberge</td></tr>
<tr><th class="docinfo-name">Date:</th>
<td>circa september 2009</td></tr>
</tbody>
</table>
<!-- Definitions of interpreted text roles (classes) for S5/HTML data. -->
<!-- This data file has been placed in the public domain. -->
<!-- Colours
======= -->
<!-- Text Sizes
========== -->
<!-- Display in Slides (Presentation Mode) Only
========================================== -->
<!-- Display in Outline Mode Only
============================ -->
<!-- Display in Print Only
===================== -->
<!-- Display in Handout Mode Only
============================ -->
<!-- Incremental Display
=================== -->
<p>This document is meant as a foolproof step by step way of using crst2s5.py
and is written in parallel with the development of <span class="green">crst2s5.py</span>.</p>
<p>Things may appear <span class="tiny">... ok, they are</span> more complicated than they should be
at this point but it will get better as time goes on.</p>
<!-- This is an example of writing an html comment; and so is the next one: -->
<!-- This document has been placed in the public domain. -->
<div class="notes container">
This is a sample speaker note.  This can appear in a secondary window.
With the defaults currently chosen for print.css, the speakers notes will
not appear if the presentation is printed - but they are very visible in the
outline view in the browser.</div>
<div class="handout container">
This is a sample text included in the outline view (and would appear if
printed as well) but which does not  appear in either the speaker notes
nor on the slide.</div>

</div>
<div class="slide" id="introduction">
<h1>Introduction</h1>
<p class="handout">crst2s5 is based on <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a>/<a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> and <a class="reference external" href="http://meyerweb.com/eric/tools/s5/">S5</a>.</p>
<div class="notes container">
<blockquote>
Showing off some speaker notes: this one was entered via the
<tt class="docutils literal"><span class="pre">..</span> <span class="pre">container::</span> <span class="pre">notes</span></tt> directive...</blockquote>
<p class="notes">... Whereas this note was entered via the <tt class="docutils literal"><span class="pre">..</span> <span class="pre">class::</span> <span class="pre">notes</span></tt> directive.</p>
</div>
<div class="topic">
<p class="topic-title first">Installation</p>
<p>See the notes for details.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">class:</th><td class="field-body">handout</td>
</tr>
</tbody>
</table>
<p>Prerequisites: Python and the <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> package have to be
installed.  See the <a class="reference external" href="http://docutils.sourceforge.net/README.html">Docutils README</a> file for installation
instructions.</p>
</div>
<ul>
<li><p class="first">This presentation was produced by the following command at a terminal prompt:</p>
<p>-python ../crunchy/crst2s5.py --theme=ui/pycon_light --theme-url=ui/pycon_light how_to.txt how_to.html</p>
<p class="handout">how_to.txt used normal reStructuredText.</p>
</li>
</ul>
</div>
<div class="slide" id="what-s-new">
<h1>What's new?</h1>
<p>Compared with rst2s5, crst2s5 introduces a few changes:</p>
<ul>
<li><p class="first">Based on S5 v1.2a  (as opposed to v1.1 for rst2s5)
This is what allows the use of speaker notes in a separate window</p>
</li>
<li><p class="first">New directive:</p>
<pre class="literal-block">
.. crunchy:: Very Little Added Markup (or vlam)
</pre>
</li>
<li><p class="first">New directive:</p>
<pre class="literal-block">
.. getpythonsource:: path/to/file/module.object.whatever [vlam]
</pre>
</li>
</ul>
</div>
<div class="slide" id="getpythonsource-tests-1">
<h1>getpythonsource tests (1)</h1>
<p>The following automatically import the module a_test_file.  When the generated
html file is viewed with Crunchy the code will be styled and line numbers will
be added.:</p>
<pre class="literal-block">
.. getpythonsource:: a_test_file python linenumber
</pre>
<pre title="python linenumber=1" xml:space="preserve">
'''a_test_file.py: a demo file for getsource.py'''

def print_squares(n):
    '''Prints a table of number and their squares'''
    for i in range(n):
        print i, i*i

class Fantastic(object):
    '''A sample class'''
    def __init__(self):
        print(&quot;Hello&quot;)

    def bye(self):
        print(&quot;Goodbye!&quot;)

</pre>
</div>
<div class="slide" id="getpythonsource-tests-2">
<h1>getpythonsource tests (2)</h1>
<p>Now, just importing the method &quot;bye&quot;, still adding line numbers ...
and an editor.</p>
<pre title="editor linenumber=13" xml:space="preserve">
    def bye(self):
        print(&quot;Goodbye!&quot;)

</pre>
</div>
<div class="slide" id="getpythonsource-tests-3">
<h1>getpythonsource tests (3)</h1>
<p>Importing the function &quot;a_function&quot;, with no linenumbers but with
an interpreter embedded.</p>
<pre title="interpreter" xml:space="preserve">
Traceback (most recent call last):
  File &quot;/Users/andre/CrunchySVN/trunk/crunchy/src/plugins/rst_directives.py&quot;, line 155, in get_lines
    to_inspect[_obj[i]] = getattr(to_inspect[_obj[i-1]], s)
AttributeError: 'module' object has no attribute 'a_function'

</pre>
</div>
<div class="slide" id="getpythonsource-tests-4">
<h1>getpythonsource tests (4)</h1>
<p>Finally, if the desired object can not be imported, a traceback is produced
instead.</p>
<pre xml:space="preserve">
Traceback (most recent call last):
  File &quot;/Users/andre/CrunchySVN/trunk/crunchy/src/plugins/rst_directives.py&quot;, line 155, in get_lines
    to_inspect[_obj[i]] = getattr(to_inspect[_obj[i-1]], s)
AttributeError: 'module' object has no attribute 'does_not_exist'

</pre>
</div>
<div class="slide" id="to-do">
<h1>To do</h1>
<ul class="simple">
<li>Note: if you are using Firefox on a Mac to do presentations,
get the <a class="reference external" href="https://addons.mozilla.org/en-US/firefox/addon/1568">Full Fullscreen</a> add-on</li>
<li>explain what to copy and where</li>
<li>explain how to use crst2s5.py</li>
<li>explain how to use html files produced by crst2s5.py<ul>
<li>by themselves</li>
<li>with Crunchy</li>
</ul>
</li>
<li>fix slides.js (v1.2a) for Crunchy</li>
</ul>
</div>
<div class="slide" id="to-do-cont-d">
<h1>To do (cont'd)</h1>
<ul class="simple">
<li>create pycon_dark style</li>
<li>Note: if using a dark theme (say, with a black background), select the
appropriate pygments theme in Crunchy's preferences.</li>
<li>END -----</li>
</ul>
</div>
<div class="slide" id="crunchy-directives-1">
<h1>crunchy directives (1)</h1>
<p>Just a basic Python program:</p>
<pre title="python" xml:space="preserve">
print &quot;Hello world!&quot;
</pre>
<p>And the Python 3 version:</p>
<pre title="python3 linenumber" xml:space="preserve">
print(&quot;Hello world!&quot;)
</pre>
</div>
<div class="slide" id="crunchy-directives-2">
<h1>crunchy directives (2)</h1>
<p>Time for including an interpreter:</p>
<pre title="interpreter" xml:space="preserve">
print &quot;Hello world!&quot;
</pre>
</div>
<div class="slide" id="crunchy-directives-3">
<h1>crunchy directives (3)</h1>
<p>This time, we include an editor:</p>
<pre title="editor linenumber" xml:space="preserve">
print &quot;Hello world!&quot;
</pre>
</div>
<div class="slide" id="crunchy-directives-4">
<h1>crunchy directives (4)</h1>
<p>Finally, how about some html code:</p>
<pre title="html" xml:space="preserve">
&lt;pre title=&quot;python&quot;&gt;
print &quot;Hello world!&quot;
&lt;/pre&gt;
</pre>
</div>
</div>
</body>
</html>
